package com.jml.controller;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.ServletRequestHandledEvent;
import org.springframework.web.servlet.FrameworkServlet;

import javax.servlet.ServletContextEvent;

/**
 * {@link FrameworkServlet#publishRequestHandledEvent}
 * 这个方法中调用可以用来记录日志
 */


@Component
public class ServletRequestHandlerEventListener implements ApplicationListener<ServletRequestHandledEvent> {

    @Override
    public void onApplicationEvent(ServletRequestHandledEvent event) {
        System.out.println("打印日志："+event.getDescription());
    }
}
